package com.mvvm.store.roombatabase;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;


import com.mvvm.store.bean.basebean.IntoMaterialBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 入库存储
 */

@Dao
public interface IntoMaterialDao {

    //查询所有的物料信息
    @Query("SELECT * FROM IntoMaterialBean")
    List<IntoMaterialBean> getAll();


    //根据单号，零件号查询数据是否存在数据
    @Query("SELECT * FROM IntoMaterialBean WHERE orderNumber=:orderNumber AND oddNumber=:oddNumber")
    List<IntoMaterialBean> getMaterialInfoByOrder(String orderNumber,String oddNumber);


    //根据扫码的订单号查询对于的该订单信息
    @Query("SELECT * FROM IntoMaterialBean WHERE orderNumber=:orderNumber")
    List<IntoMaterialBean> getMaterialInfo(String orderNumber);


    //chax
    @Query("SELECT * FROM IntoMaterialBean WHERE orderNumber !=:orderNumber")
    List<IntoMaterialBean> getMaterialInfoScanInforResult(String orderNumber);

    //根据扫码的零件号查询对于的该订单信息
    @Query("SELECT * FROM IntoMaterialBean WHERE oddNumber=:oddNumber")
    List<IntoMaterialBean> getMaterialInfoByOddNumber(String oddNumber);


    //新增扫码数据
    @Insert
    void insertAll(IntoMaterialBean... intoMaterialBeans);


    //修改单挑记录
    @Update
    void updateStudent(IntoMaterialBean... users);


    //删除对于的备案数据
    @Delete
    void delete(IntoMaterialBean user);


    //根据id查询对于的物料信息
    @Query("SELECT *FROM IntoMaterialBean WHERE sId=:sId")
    List<IntoMaterialBean> getStockUpInfoById(int sId);
}
